<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录 - 七牛云盘系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .login-container {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            padding: 40px;
            width: 100%;
            max-width: 420px;
            margin: 20px;
        }
        .login-logo {
            text-align: center;
            margin-bottom: 30px;
        }
        .login-logo img {
            width: 80px;
            margin-bottom: 15px;
        }
        .login-logo h2 {
            color: #333;
            font-weight: 600;
            margin-bottom: 10px;
        }
        .form-control {
            border-radius: 8px;
            padding: 12px;
            border: 2px solid #eee;
            transition: all 0.3s;
        }
        .form-control:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
        }
        .login-btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 8px;
            padding: 12px;
            width: 100%;
            font-weight: 600;
            margin-top: 20px;
            transition: all 0.3s;
        }
        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        .login-error {
            background-color: #fee2e2;
            border: 1px solid #fecaca;
            color: #dc2626;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 20px;
            text-align: center;
        }
        .alert-success {
            background-color: #dcfce7;
            border: 1px solid #bbf7d0;
            color: #16a34a;
            padding: 12px;
            border-radius: 8px;
            margin-bottom: 20px;
            text-align: center;
        }
        .form-check-input:checked {
            background-color: #667eea;
            border-color: #667eea;
        }
    </style>
</head>
<body>
<div class="login-container">
    <div class="login-logo">
        <i class="bi bi-cloud-fill" style="font-size: 3rem; color: #667eea;"></i>
        <h2>七牛云盘系统</h2>
        <p class="text-muted">安全存储，随时访问</p>
    </div>

    <form th:action="@{/login}" method="post" class="needs-validation" novalidate>
        <div class="login-error" th:if="${param.error}">
            <i class="bi bi-exclamation-circle-fill me-2"></i>
            用户名或密码错误，请重试
        </div>

        <div class="alert alert-success" th:if="${param.logout}">
            <i class="bi bi-check-circle-fill me-2"></i>
            您已成功退出登录
        </div>

        <div class="mb-4">
            <div class="input-group">
                    <span class="input-group-text bg-transparent border-end-0">
                        <i class="bi bi-person-fill text-muted"></i>
                    </span>
                <input type="text" class="form-control border-start-0" id="username" name="username"
                       placeholder="请输入用户名" required autofocus>
            </div>
        </div>

        <div class="mb-4">
            <div class="input-group">
                    <span class="input-group-text bg-transparent border-end-0">
                        <i class="bi bi-lock-fill text-muted"></i>
                    </span>
                <input type="password" class="form-control border-start-0" id="password" name="password"
                       placeholder="请输入密码" required>
            </div>
        </div>

        <div class="mb-4 form-check">
            <input type="checkbox" class="form-check-input" id="rememberMe" name="remember-me">
            <label class="form-check-label" for="rememberMe">记住我的登录状态</label>
        </div>

        <button type="submit" class="btn btn-primary login-btn">
            <i class="bi bi-box-arrow-in-right me-2"></i>登录
        </button>
    </form>
</div>

<script>
    // 表单验证
    (function () {
        'use strict'
        var forms = document.querySelectorAll('.needs-validation')
        Array.prototype.slice.call(forms).forEach(function (form) {
            form.addEventListener('submit', function (event) {
                if (!form.checkValidity()) {
                    event.preventDefault()
                    event.stopPropagation()
                }
                form.classList.add('was-validated')
            }, false)
        })
    })()
</script>
</body>
</html> 